/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.analysis.businesspartner.link;

import cn.ekuma.data.ui.swing.AbstractJXTablePanel;
import cn.ekuma.epos.bean.util.erp.OrderRelationInfoHelper;
import cn.ekuma.epos.order.model.OrderRelationTableModel;
import cn.ekuma.epos.qkorder.event.OrderChangedEvent;
import cn.ekuma.epos.qkorder.event.OrderChangedListener;
import com.openbravo.pos.base.AppLocal;
import com.openbravo.bean.erp.Order;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

/**
 *
 * @author Administrator
 */
public class JOrderShardPanel extends AbstractJXTablePanel implements OrderChangedListener{

    OrderRelationTableModel tableModel;
    Order order;

    public JOrderShardPanel() {
        super();
        JButton createOrder=new JButton();
        createOrder.setText(AppLocal.getIntString("button.createOrder")); // NOI18N
        createOrder.setFocusable(false);
        createOrder.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        createOrder.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tableModel=new OrderRelationTableModel();
        getJXTable().setModel(tableModel);
        createOrder.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                createOrder();
            }
        });
    }

       private void createOrder() {
                throw new UnsupportedOperationException("Not yet implemented");
       }

    @Override
    public boolean removeSelectedObjects(int[] objs) {
        for(Object o:objs){
            //tableModel.remove(o);
        }
        return true;
    }

    @Override
    public void addObject() {
        tableModel.add(OrderRelationInfoHelper.converForOrder(order));
    }

    public void orderChanged(OrderChangedEvent event) {
       order=event.getOrder();
    }

    @Override
    public void editObjectAt(int row) {
        
    }

}
